package com.heima.feigns;


import com.heima.feigns.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.ArticleFeignFallback;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.vos.SearchArticleVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "leadnews-article", fallbackFactory = ArticleFeignFallback.class , configuration = HeimaFeignAutoConfiguration.class)
public interface ArticleFeign {

    /**
     * 根据id 查询作者是否勋在
     *
     * @param id
     * @return
     */
    @GetMapping("/api/v1/author/findByUserId/{id}")
    ResponseResult<ApAuthor> findByUserId(@PathVariable("id") Integer id);


    @PostMapping("/api/v1/author/save")
    ResponseResult<ApAuthor> saveAuthor(@RequestBody ApAuthor apAuthor);


    /**
     * 根据id查询文章信息
     * @param id
     * @return
     */
    @GetMapping("/api/v1/article/{id}")
    ResponseResult<SearchArticleVO> findArticle(@PathVariable("id") Long id);

}



    /**
//     * 根据文章id查询文章信息
//     */
//    public ResponseResult<ApArticle> findArticle( Long id);
//}
